<#ibizinclude>
../../../@MACRO/LANG_FUN.ftl
</#ibizinclude>
<#if item.getPSAppView()??>

/**
 * ${item.getName()}
 *
 * @param {*} [item={}]
 * @memberof ${srfclassname('${ctrl.codeName}')}
 */
<#assign dataview = item.getPSAppView()/>
public click${item.codeName}(item: any = {}) {
<#if dataview.isRedirectView()>
    this.$Notice.warning({ title: '警告', desc: '重定向视图暂不支持应用功能打开' });
<#else>
    const viewparam: any = {};
    <#if item.getOpenViewParam?? && item.getOpenViewParam()??>
    Object.assign(viewparam, ${item.getOpenViewParam()});
    </#if>
    const deResParameters: any[] = [];
    <#--  BEGIN：准备参数  -->
    <#if dataview.getOpenMode() == 'INDEXVIEWTAB' || dataview.getOpenMode() == ''>
    <#--  BEGIN：是否应用实体视图  -->
    <#if dataview.isPSDEView()>
    <#assign appDataEntity = dataview.getPSAppDataEntity()/>
    const parameters: any[] = [
        { pathName: '${srfpluralize(appDataEntity.codeName)?lower_case}', parameterName: '${appDataEntity.getCodeName()?lower_case}' },
        { pathName: '${dataview.getPSDEViewCodeName()?lower_case}', parameterName: '${dataview.getPSDEViewCodeName()?lower_case}' },
    ];
    <#else>
    const parameters: any[] = [
        { pathName: '${dataview.getCodeName()?lower_case}', parameterName: '${dataview.getCodeName()?lower_case}' },
    ];
    </#if>
    <#--  END：是否应用实体视图  -->
    <#else>
    <#--  BEGIN：是否应用实体视图  -->
    <#if dataview.isPSDEView()>
    <#assign appDataEntity = dataview.getPSAppDataEntity()/>
    const parameters: any[] = [
        { pathName: '${srfpluralize(appDataEntity.codeName)?lower_case}', parameterName: '${appDataEntity.getCodeName()?lower_case}' },
    ];
    <#else>
    const parameters: any[] = [];
    </#if>
    <#--  END：是否应用实体视图  -->
    </#if>
    <#--  END：准备参数  -->
    <#if dataview.getOpenMode() == 'INDEXVIEWTAB' || dataview.getOpenMode() == ''>
    const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
    if(Object.is(this.$route.fullPath,path)){
        return;
    }
    this.$nextTick(function(){
        this.$router.push(path);
    })
    </#if>
    <#if dataview.getOpenMode() == 'POPUP'>
    console.log('-----POPUP-----非模式弹出，暂时不实现');
    </#if>
    <#if dataview.getOpenMode() == 'POPUPMODAL'>
    const view = { 
        viewname: '${srffilepath2(dataview.getCodeName())}', 
        title: (this.<@getViewLanguageTitle dataview /> as any),
        height: ${dataview.getHeight()?c}, 
        width: ${dataview.getWidth()?c}, 
    };
    const appmodal = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(this.context)),viewparam);
    appmodal.subscribe((result: any) => {
        console.log(result);
    });
    </#if>
    <#if dataview.getOpenMode() == 'POPUPAPP'>
    <#--  打开独立程序弹出  -->
    const _this: any = this;
    const routePath = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
    window.open('./#'+routePath, '_blank');
    </#if>
    <#if dataview.getOpenMode()?index_of('DRAWER') == 0>
    const view: any = {
        viewname: '${srffilepath2(dataview.getCodeName())}',
        title: (this.<@getViewLanguageTitle dataview /> as any),
        height: ${dataview.getHeight()?c},
        width: ${dataview.getWidth()?c},
        placement: '${dataview.getOpenMode()}'
    };
    const appdrawer = this.$appdrawer.openDrawer(view, JSON.parse(JSON.stringify(this.context)), viewparam);
    appdrawer.subscribe((result: any) => {
        console.log(result);
    });
    </#if>
    <#if dataview.getOpenMode() == 'POPOVER'>
    const view: any = {
        viewname: '${srffilepath2(dataview.getCodeName())}',
        title: (this.<@getViewLanguageTitle dataview /> as any),
        height: ${dataview.getHeight()?c},
        width: ${dataview.getWidth()?c},
        placement: '${dataview.getOpenMode()}'
    };
    const appPopover = this.$apppopover.openPop($event, view, JSON.parse(JSON.stringify(this.context)), viewparam);
    appPopover.subscribe((result: any) => {
        console.log(result);
    });
    </#if>
    <#if dataview.getOpenMode()?index_of('USER') == 0>
    console.log('-----${dataview.getOpenMode()}-----用户自定义');
    </#if>
</#if>
}
</#if>